package day1;

import java.util.Arrays;

public class arrTest {


    public void demo(){
        //静态初始化
        String[] arrayName = new String[]{"12","good"};

        //动态初始化
        Object[] books = new String[4];

        books[0] = "good";
        books[1] = "good1";
        books[2] = "good2";
        books[3] = "good3";

        System.out.println(books[0]);

        //使用
        for(int i=0;i<books.length;i++){
            System.out.println(books[i]);
        }

        System.out.println("-----");

        for(Object book : books){
            System.out.println(book);
        }


    }

    //深入数组学习  堆内存 栈内存
    public void good(){
        int[] iArr;
        iArr = new int[5];
        for (int i=0;i<iArr.length;i++){
            iArr[i] = i+10;
        }
    }

    //引入类型数组的初始化

    public void student(){

        Person[] students;

        students = new Person[2];

        Person zhang = new Person();
        zhang.age = 12;
        zhang.height=12;



        Person lee = new Person();
        lee.age = 100;
        lee.height = 100;

        students[0] = zhang;
        students[1] = lee;


        lee.info();
        students[1].info();

    }

    //没有多维数组


    //java8的增强的工具类 Arrays

    public void group(){
        int[] a = new int[]{3,4,5,6};
        int[] a2 = new int[]{3,4,5,6};
        System.out.println("是否相等"+ Arrays.equals(a,a2));
    }


}
